package com.zst.demo4.service.impl;

import com.zsr.entities.PermissionDTO;
import com.zst.demo4.converter.PermissionConverter;
import com.zst.demo4.mapper.PermissionMapper;
import com.zst.demo4.po.PermissionPO;
import com.zst.demo4.service.IPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
@Slf4j
public class PermissionServiceImpl implements IPermissionService {
    @Autowired
    PermissionMapper permissionMapper;

    @Override
    public Optional<PermissionDTO> getPermissionById(Long id) {
        PermissionPO permissionPO = permissionMapper.selectById(id);
        return Optional.of(PermissionConverter.convert2PermissionDTO(permissionPO));
    }
}
